<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <cpn1></cpn1>
    <cpn2></cpn2>
</div>
<script src="../js/vue.js"></script>
<script>
    //1.非语法糖
    const cpn1 = Vue.extend({
        template:
            `
            <div>
                <h2>模板1</h2>
           </div>
            `,

    })
    Vue.component('cpn', cpn1);

    const aaa = new Vue({
        el: "#app",
        data: {
            message: "hello,guys",
        },
        components: {
            cpn1: cpn1
        }
    })

    //2.语法糖
    Vue.component('cpn', {
        template:
            `
            <div>
                <h2>模板1</h2>
           </div>
            `,

    });

    const aaa = new Vue({
        el: "#app",
        data: {
            message: "hello,guys",
        },
        components: {
            cpn1: {
                template:
                    `
            <div>
                <h2>模板1</h2>
           </div>
            `,

            }
        }
    })

</script>
</body>
</html>